package com.cj.services;

import com.cj.models.ProductModel;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class ProdService {
    public List<ProductModel> getProdlist(){
        return new ArrayList<ProductModel>(){
            {
                add(new ProductModel(101,"prod1"));
                add(new ProductModel(102,"prod2"));
            }
        };
    } //商品列表

    public ProductModel getProd(int pid){
        return new ProductModel(pid,"prod_"+pid);
    }
    @Async
    public void setProMeta(int pid,String metaKey) throws InterruptedException {
        Thread.sleep(2000);
        System.out.println("商品ID为"+pid+"的meta信息:"+metaKey+"设置成功");
    }

}
